CRONO SDK 1.0.1
CRONO_SDK.h
Go to the documentation of this file.
1/*
2################################################################################
3
4Copyright 2024 Micro-Photon-Devices s.r.l.
5
6SOFTWARE PRODUCT: CRONO_SDK 1.0.1
7
8Micro-Photon-Devices (MPD) expressly disclaims any warranty for the SOFTWARE
9PRODUCT. The SOFTWARE PRODUCT is provided 'As Is' without any express or
10implied warranty of any kind, including but not limited to any warranties of
11merchantability, noninfringement, or fitness of a particular purpose. MPD does
12not warrant or assume responsibility for the accuracy or completeness of any
13information, text, graphics, links or other items contained within the SOFTWARE
14PRODUCT. MPD further expressly disclaims any warranty or representation to
15Authorized Users or to any third party. In no event shall MPD be liable for
16any damages (including, without limitation, lost profits, business interruption
17or lost information) rising out of 'Authorized Users' use of or inability to
18use the SOFTWARE PRODUCT, even if MPD has been advised of the possibility of
19such damages. In no event will MPD be liable for loss of data or for indirect,
20special, incidental, consequential (including lost profit), or other damages
21based in contract, tort or otherwise. MPD shall have no liability with respect
22to the content of the SOFTWARE PRODUCT or any part thereof, including but not
23limited to errors or omissions contained therein, libel, infringements of
24rights of publicity, privacy, trademark rights, business interruption, personal
25injury, loss of privacy, moral rights or the disclosure of confidential
26information.
27
28################################################################################
29*/
30
31#pragma once
32
33#ifndef __CRONO_SDK_h__
34#define __CRONO_SDK_h__
35
36#ifdef __cplusplus
37extern "C"
38{
39#endif
40
62#include <stdlib.h>
63#include <stdint.h>
64
65#ifdef _WIN32
66#ifdef CRONO_SDK_EXPORTS
67#define CRONO_SDK_API __declspec(dllexport)
68#else
69#define CRONO_SDK_API __declspec(dllimport)
70#endif
71#else
72#define CRONO_SDK_API
73#endif
74
81#define MAX_PATTERN_LENGTH 8192
83#define MIN_GATE_OFF 12
85#define MIN_GATE_ON 5
87#define MAX_SERIAL_LENGTH 20
89#define MAX_DATETIME_LENGTH 100
99typedef uint8_t cronoBool;
102typedef struct Crono *CRONO_H;
107typedef enum
108{
109 NO_ERR = 0,
131 RAM_FULL = 22,
139
141typedef enum
142{
146
149typedef struct
150{
152 char Serial[MAX_SERIAL_LENGTH];
161
164typedef struct
165{
166 char DateTime[MAX_DATETIME_LENGTH];
169
173typedef enum
174{
175 TIMING = 0,
176 COUNTING = 1
178
182typedef enum
183{
184 OFF = 0,
187 BOTH_EDGES = 3
189
192typedef struct
193{
204 int64_t auxBitACount;
205 int64_t auxBitBCount;
209
212typedef struct
213{
215 // sensor roi
219 // counting/timing mode
221 // acquisition
223 uint64_t acqMaxFrames;
224 // start
226 double frameRate;
230 // gate
234 uint16_t internalGatePattern[MAX_PATTERN_LENGTH];
236 // laser sync
237 uint16_t laserSyncPattern[MAX_PATTERN_LENGTH];
239 // sma output channels selection
243 // ext trigger
246 // aux signals sampling modes
250
267CRONO_SDK_API CRONO_Return CRONO_Constr(CRONO_H *crono);
268
275CRONO_SDK_API CRONO_Return CRONO_Destr(CRONO_H crono);
276
291CRONO_SDK_API CRONO_Return CRONO_GetDeviceCount(CRONO_H crono, int *count);
292
301CRONO_SDK_API CRONO_Return CRONO_GetDeviceSerial(CRONO_H crono, int deviceIndex, char *buf);
302
310CRONO_SDK_API CRONO_Return CRONO_OpenDeviceBySerial(CRONO_H crono, char *serial);
311
320CRONO_SDK_API CRONO_Return CRONO_GetDeviceInfo(CRONO_H crono, char *serial, CRONO_DeviceInfo *deviceInfo);
321
332CRONO_SDK_API CRONO_Return CRONO_OpenDeviceAsDataConverter(CRONO_H crono, char *rawFilePath);
333
349CRONO_SDK_API CRONO_Return CRONO_SetSpadDeadTime(CRONO_H crono, int deadTimeNs);
350
359
371CRONO_SDK_API CRONO_Return CRONO_ConfigSensor(CRONO_H crono, int activePixels, cronoBool half1Enable, cronoBool half2Enable, double *maxFrameStartFrequency);
372
380CRONO_SDK_API CRONO_Return CRONO_GetActivePixels(CRONO_H crono, int *activePixels);
381
390
399
407CRONO_SDK_API CRONO_Return CRONO_LoadSettingsFromFile(CRONO_H crono, char *path);
408
416CRONO_SDK_API CRONO_Return CRONO_SaveSettingsToFile(CRONO_H crono, char *path);
417
432CRONO_SDK_API CRONO_Return CRONO_ConfigAcquisition(CRONO_H crono, CRONO_PixelMode pixelMode, cronoBool framesEnable, cronoBool histogramsEnable, cronoBool timeTagsEnable, cronoBool liveEnable, cronoBool unused, const char *rawDataOutPath);
433
455CRONO_SDK_API CRONO_Return CRONO_StartAcquisition(CRONO_H crono, uint64_t acqMaxFrames, int integPeriodFrames);
456
465
474
483
494CRONO_SDK_API CRONO_Return CRONO_GetFramesData(CRONO_H crono, uint32_t *buf, uint64_t capacityNumFrames, uint64_t *copiedNumFrames);
495
505CRONO_SDK_API CRONO_Return CRONO_GetTimeTagsData(CRONO_H crono, uint64_t *dataBuf, uint64_t capacity, uint64_t *copiedLen);
506
516CRONO_SDK_API CRONO_Return CRONO_GetHistogramData(CRONO_H crono, uint32_t *buf, uint64_t capacityNumHists, uint64_t *copiedNumHists);
517
527CRONO_SDK_API CRONO_Return CRONO_GetLiveData(CRONO_H crono, uint32_t *countsBuf, uint32_t *histogramBuf, cronoBool *dataIsNew);
528
546CRONO_SDK_API CRONO_Return CRONO_ConfigFrameStartInternal(CRONO_H crono, double frameRate, double *actualBin);
547
559CRONO_SDK_API CRONO_Return CRONO_ConfigFrameStartExternal(CRONO_H crono, double frameRate, double threshold, cronoBool externalStartPosedge, int divFactor);
560
568CRONO_SDK_API CRONO_Return CRONO_ConfigGateExternal(CRONO_H crono, double threshold, cronoBool externalGateInvert);
569
580CRONO_SDK_API CRONO_Return CRONO_ConfigGateInternal(CRONO_H crono, int *pattern, int patternLen);
581
591CRONO_SDK_API CRONO_Return CRONO_ConfigLaserSync(CRONO_H crono, int *pattern, int patternLen);
592
606CRONO_SDK_API CRONO_Return CRONO_ConfigOutputs(CRONO_H crono, int chan1Selection, int chan2Selection, int chan3Selection);
607
617CRONO_SDK_API CRONO_Return CRONO_ConfigAuxiliaryInputs(CRONO_H crono, CRONO_AuxInputMode bitModeA, CRONO_AuxInputMode bitModeB, double bitAThreshold);
618
626CRONO_SDK_API CRONO_Return CRONO_ConfigTriggerExternal(CRONO_H crono, int framesBurstCount);
627
635
645CRONO_SDK_API CRONO_Return CRONO_GetInputFrequencies(CRONO_H crono, double *extStartFrequency, double *extGateFrequency, double *extTriggerFrequency);
646
649#ifdef _MPD_DEV_
650#include "MPD_Utils.h"
651#endif
652
655#ifdef __cplusplus
656} // extern "C"
657#endif
658
659#endif // ifndef __CRONO_SDK_h__
CRONO_Return CRONO_SaveSettingsToFile(CRONO_H crono, char *path)
Saves current settings to file.
CRONO_Return CRONO_LoadSettingsFromFile(CRONO_H crono, char *path)
Loads Crono settings from a file.
CRONO_Return CRONO_GetCameraSettings(CRONO_H crono, CRONO_CameraSettings *settings)
Gets actual Crono settings and saves them in a user provided CRONO_CameraSettings struct passed by re...
CRONO_Return CRONO_LoadCameraSettings(CRONO_H crono, CRONO_CameraSettings settings)
Loads Crono settings from a CRONO_CameraSettings struct.
CRONO_Return CRONO_GetSensorType(CRONO_H crono, CRONO_SensorType *sensorType)
Retrieves the sensor type (128x1 or 8x8)
CRONO_Return CRONO_GetActivePixels(CRONO_H crono, int *activePixels)
Gets the number of active pixels currently configured.
CRONO_Return CRONO_ConfigAcquisition(CRONO_H crono, CRONO_PixelMode pixelMode, cronoBool framesEnable, cronoBool histogramsEnable, cronoBool timeTagsEnable, cronoBool liveEnable, cronoBool unused, const char *rawDataOutPath)
configures the acquisition modes and selects the output data formats.
CRONO_Return CRONO_ConfigSensor(CRONO_H crono, int activePixels, cronoBool half1Enable, cronoBool half2Enable, double *maxFrameStartFrequency)
Configures the Crono spad array sensor region of interest, i.e.
CRONO_Return CRONO_SetSpadDeadTime(CRONO_H crono, int deadTimeNs)
Sets the SPADs dead time in ns.
CRONO_Return CRONO_ConfigTriggerExternal(CRONO_H crono, int framesBurstCount)
Sets the camera in external trigger mode.
CRONO_Return CRONO_ConfigAuxiliaryInputs(CRONO_H crono, CRONO_AuxInputMode bitModeA, CRONO_AuxInputMode bitModeB, double bitAThreshold)
Configure aux inputs sampling.
CRONO_Return CRONO_ConfigGateExternal(CRONO_H crono, double threshold, cronoBool externalGateInvert)
Sets the camera in external gate mode and configure the associated parameters.
CRONO_Return CRONO_GetInputFrequencies(CRONO_H crono, double *extStartFrequency, double *extGateFrequency, double *extTriggerFrequency)
Gets the current meaured input signal frequencies at the SMA inputs.
CRONO_Return CRONO_ConfigOutputs(CRONO_H crono, int chan1Selection, int chan2Selection, int chan3Selection)
Configures which Crono signals are forwarded to each of the three output ports.
CRONO_Return CRONO_ConfigFrameStartExternal(CRONO_H crono, double frameRate, double threshold, cronoBool externalStartPosedge, int divFactor)
Sets the camera in external frame start mode and configure the associated parameters.
CRONO_Return CRONO_ConfigLaserSync(CRONO_H crono, int *pattern, int patternLen)
Configures the pattern of internally generated laser syncronization signal.
CRONO_Return CRONO_ConfigGateInternal(CRONO_H crono, int *pattern, int patternLen)
Set the camera in internal gate mode and configures the pattern of internally generated gate.
CRONO_Return CRONO_ConfigTriggerInternal(CRONO_H crono)
Sets the camera in internal trigger mode.
CRONO_Return CRONO_ConfigFrameStartInternal(CRONO_H crono, double frameRate, double *actualBin)
Sets the camera in internal frame start mode and sets the frame start rate.
CRONO_Return CRONO_Destr(CRONO_H crono)
Frees all resources owned by a Crono handle.
CRONO_Return CRONO_Constr(CRONO_H *crono)
Constructs a new Crono object.
CRONO_Return CRONO_GetTimeTagsData(CRONO_H crono, uint64_t *dataBuf, uint64_t capacity, uint64_t *copiedLen)
Gets an acquisition data chuck in time tags format.
CRONO_Return CRONO_StopAcquisition(CRONO_H crono, cronoBool force)
Stops an ongoing acquisition.
CRONO_Return CRONO_GetHistogramData(CRONO_H crono, uint32_t *buf, uint64_t capacityNumHists, uint64_t *copiedNumHists)
Gets an acquisition data chuck in histogram format.
CRONO_Return CRONO_GetAcquisitionStatus(CRONO_H crono, CRONO_AcquisitionStatus *status)
Gets the current acquisition status.
CRONO_Return CRONO_GetLiveData(CRONO_H crono, uint32_t *countsBuf, uint32_t *histogramBuf, cronoBool *dataIsNew)
Gets latest live data whenever available.
CRONO_Return CRONO_GetFramesData(CRONO_H crono, uint32_t *buf, uint64_t capacityNumFrames, uint64_t *copiedNumFrames)
Gets an acquisition data chuck in frames format.
CRONO_Return CRONO_GetAcquisitionInfo(CRONO_H crono, CRONO_AcquisitionInfo *acqInfo)
Gets informations about the last acquisition.
CRONO_Return CRONO_StartAcquisition(CRONO_H crono, uint64_t acqMaxFrames, int integPeriodFrames)
Starts a new acquisition.
#define MAX_PATTERN_LENGTH
Maximum pattern length in ns.
Definition: CRONO_SDK.h:81
#define MAX_SERIAL_LENGTH
Maximum serial number string length.
Definition: CRONO_SDK.h:87
#define MAX_DATETIME_LENGTH
Maximum date and time string length.
Definition: CRONO_SDK.h:89
CRONO_Return CRONO_GetDeviceCount(CRONO_H crono, int *count)
Gets the count of all active and connected Crono devices.
CRONO_Return CRONO_OpenDeviceBySerial(CRONO_H crono, char *serial)
Opens a device with a given serial number.
CRONO_Return CRONO_GetDeviceInfo(CRONO_H crono, char *serial, CRONO_DeviceInfo *deviceInfo)
Gets information about a device with a given serial number, or of the already open device.
CRONO_Return CRONO_GetDeviceSerial(CRONO_H crono, int deviceIndex, char *buf)
Get the serial number of a connected Crono device given its numeric index.
CRONO_Return CRONO_OpenDeviceAsDataConverter(CRONO_H crono, char *rawFilePath)
Open saved Crono raw file as a virtual device for data conversion.
int integPeriodFrames
Number of frames to be integrated for histogram or frame accumulation.
Definition: CRONO_SDK.h:222
uint64_t acquiredFramesCount
Number of acquired frames.
Definition: CRONO_SDK.h:167
int deadTimeNs
SPAD deadtime in ns.
Definition: CRONO_SDK.h:214
int64_t auxBitACount
Count of bit A samples>.
Definition: CRONO_SDK.h:204
int64_t decodedFrameCount
Number of frames decoded by SDK since acquisition start.
Definition: CRONO_SDK.h:196
cronoBool startIsExternal
True if start signal is externally generated.
Definition: CRONO_SDK.h:225
cronoBool ongoing
Boolean value that indicates wether the acquisition is ongoing.
Definition: CRONO_SDK.h:206
int64_t hostAllocatedBytes
Current ram usage for storing acquired and decoded data on the host computer.
Definition: CRONO_SDK.h:199
int SdkMinorVersion
SDK minor version.
Definition: CRONO_SDK.h:157
CRONO_AuxInputMode AuxInputASamplingMode
Aux A (Gate input) sampling mode.
Definition: CRONO_SDK.h:247
int FwMinorVersion
Firmware minor version.
Definition: CRONO_SDK.h:154
int SdkMajorVersion
SDK major version.
Definition: CRONO_SDK.h:156
int64_t availableRawCount
Number of currently buffered raw data values.
Definition: CRONO_SDK.h:200
int64_t deviceRamUsageBytes
Current usage of Crono device RAM expressed in bytes.
Definition: CRONO_SDK.h:197
int SdkPatchVersion
SDK patch version.
Definition: CRONO_SDK.h:158
int activePixels
Number of active pixels.
Definition: CRONO_SDK.h:216
double frameRate
Start frequency (actual if internal, maximum expected if external).
Definition: CRONO_SDK.h:226
int64_t capturedFrameCount
Number of frames captured by the camera since acquisition start.
Definition: CRONO_SDK.h:195
int laserSyncPatternLenght
Number of elements in the gate sync pattern.
Definition: CRONO_SDK.h:238
cronoBool deviceRamFull
Boolean value that indicates wether the Crono device RAM is full.
Definition: CRONO_SDK.h:207
CRONO_SensorType SensorType
Sensor type, 128x1 or 8x8.
Definition: CRONO_SDK.h:151
double externalGateThreshold
Threshold for external gate signal.
Definition: CRONO_SDK.h:232
int chan3Selection
Signal selection for SMA output 3.
Definition: CRONO_SDK.h:242
int64_t availableHistogramCount
Number of currently buffered histograms.
Definition: CRONO_SDK.h:203
int FwPatchVersion
Firmware patch version.
Definition: CRONO_SDK.h:155
cronoBool gateIsExternal
True if gate signal is externally generated.
Definition: CRONO_SDK.h:231
int internalGatePatternLenght
Number of elements in the gate pattern.
Definition: CRONO_SDK.h:235
int64_t downloadedBytes
Number of downloaded bytes on the host computer since acquisition start.
Definition: CRONO_SDK.h:198
int64_t auxBitBCount
Count of bit B samples>.
Definition: CRONO_SDK.h:205
cronoBool half1Enable
True if 1st half of imager is enabled.
Definition: CRONO_SDK.h:217
int externalTriggerBurstCount
Number of frames to be acquired for each trigger pulse.
Definition: CRONO_SDK.h:245
cronoBool acquireOnExtTrigger
True if acquisition is controller by external trigger.
Definition: CRONO_SDK.h:244
int chan1Selection
Signal selection for SMA output 1.
Definition: CRONO_SDK.h:240
cronoBool externalGateInvert
True if external start is inverted.
Definition: CRONO_SDK.h:233
uint64_t acqMaxFrames
Total number of frames to be acquired.
Definition: CRONO_SDK.h:223
double externalStartThreshold
Threshold for external start signal.
Definition: CRONO_SDK.h:227
int chan2Selection
Signal selection for SMA output 2.
Definition: CRONO_SDK.h:241
int externalStartDivisionFactor
Division factor for external start.
Definition: CRONO_SDK.h:229
int64_t availableFramesCount
Number of currently buffered frames.
Definition: CRONO_SDK.h:201
cronoBool externalStartPosedge
True if external start is active on rising edge.
Definition: CRONO_SDK.h:228
int UsbSpeed
Speed grade of the USB connection.
Definition: CRONO_SDK.h:159
int FwMajorVersion
Firmware major version.
Definition: CRONO_SDK.h:153
cronoBool half2Enable
True if 2nd half of imager is enabled.
Definition: CRONO_SDK.h:218
CRONO_AuxInputMode AuxInputBSamplingMode
Aux B (Trigger input) sampling mode.
Definition: CRONO_SDK.h:248
int64_t availableTimeTagsCount
Number of currently buffered time tags values.
Definition: CRONO_SDK.h:202
CRONO_PixelMode countingMode
Camera operation mode.
Definition: CRONO_SDK.h:220
double acquisitionTime
Elapsed time in seconds since acquisition start.
Definition: CRONO_SDK.h:194
struct Crono * CRONO_H
Type CRONO_H.
Definition: CRONO_SDK.h:102
CRONO_AuxInputMode
Crono auxiliary inputs sampling mode enumeration.
Definition: CRONO_SDK.h:183
CRONO_SensorType
Crono sensor types enumeration.
Definition: CRONO_SDK.h:142
CRONO_PixelMode
Crono pixel mode enumeration.
Definition: CRONO_SDK.h:174
CRONO_Return
Error table.
Definition: CRONO_SDK.h:108
uint8_t cronoBool
Type cronoBool.
Definition: CRONO_SDK.h:99
@ RISING_EDGE
Sample the auxiliary input on rising edge.
Definition: CRONO_SDK.h:185
@ BOTH_EDGES
Sample the auxiliary input on both rising and falling edges.
Definition: CRONO_SDK.h:187
@ OFF
Do not sample the auxiliary input.
Definition: CRONO_SDK.h:184
@ FALLING_EDGE
Sample the auxiliary input on falling edge.
Definition: CRONO_SDK.h:186
@ CRONO_8X8
8x8 pixels sensor
Definition: CRONO_SDK.h:143
@ CRONO_128X1
128x1 pixels sensor
Definition: CRONO_SDK.h:144
@ TIMING
Event timing mode.
Definition: CRONO_SDK.h:175
@ COUNTING
Event counting mode.
Definition: CRONO_SDK.h:176
@ DEVICE_NOT_FOUND
No Crono device was found.
Definition: CRONO_SDK.h:110
@ INVALID_LASER_SYNC_LENGHT
Laser sync length out of bound.
Definition: CRONO_SDK.h:125
@ DEVICE_NOT_OPEN
There is no open device.
Definition: CRONO_SDK.h:112
@ PATTERN_TOO_LONG
Pattern too long.
Definition: CRONO_SDK.h:133
@ INVALID_PIXEL_NUMBER
Pixel number out of bound.
Definition: CRONO_SDK.h:118
@ INVALID_DATA_FILE
Data file format is not valid.
Definition: CRONO_SDK.h:115
@ INVALID_THRESHOLD
Threshold out of bound.
Definition: CRONO_SDK.h:127
@ NULL_POINTER
A NULL pointer was passed to the function.
Definition: CRONO_SDK.h:132
@ INVALID_FRAME_BURST_COUNT
Frame burst value out of bound.
Definition: CRONO_SDK.h:123
@ LOGIC_VERSION_FAIL
The version of the camera firmware is not compatible.
Definition: CRONO_SDK.h:111
@ DEVICE_ALREADY_OPEN
There is already an open device.
Definition: CRONO_SDK.h:113
@ INVALID_CONFIG
Configuration is not valid.
Definition: CRONO_SDK.h:126
@ FPGA_FAILED
Camera not responding.
Definition: CRONO_SDK.h:136
@ INVALID_DIVISION_FACTOR
Division factor out of bound.
Definition: CRONO_SDK.h:122
@ INVALID_ENUM
Enum out of bound.
Definition: CRONO_SDK.h:135
@ INVALID_START_RATE
Start rate out of bound.
Definition: CRONO_SDK.h:121
@ FPGA_TIMEOUT
Communication timeout.
Definition: CRONO_SDK.h:137
@ ACQ_ONGOING
Acquisition is ongoing.
Definition: CRONO_SDK.h:129
@ NO_ERR
The function returned successfully.
Definition: CRONO_SDK.h:109
@ ACQ_EXT_TRIG_TIMEOUT
Timeout waiting for external trigger.
Definition: CRONO_SDK.h:130
@ INVALID_DEAD_TIME
Deadtime out of bound.
Definition: CRONO_SDK.h:119
@ INVALID_CHANNEL
Channel out of bound.
Definition: CRONO_SDK.h:134
@ RAM_FULL
Camera RAM is full.
Definition: CRONO_SDK.h:131
@ INVALID_HALVES_CONFIG
Halves configuration is not valid.
Definition: CRONO_SDK.h:120
@ SENSOR_FAILED
Hardware error.
Definition: CRONO_SDK.h:116
@ INVALID_GATE_LENGHT
Gate length out of bound.
Definition: CRONO_SDK.h:124
@ DEVICE_OPEN_AS_CONVERTER
The device is open as data converter.
Definition: CRONO_SDK.h:114
@ POWER_FAILED
Hardware error.
Definition: CRONO_SDK.h:117
@ NO_SUCH_FILE_OR_DIRECTORY
File not found.
Definition: CRONO_SDK.h:128
Struct containing information about the acquisition.
Definition: CRONO_SDK.h:165
Struct containing the status of an ongoing Crono acquisition.
Definition: CRONO_SDK.h:193
Struct containing camera settings.
Definition: CRONO_SDK.h:213
Struct containing information about the version and connection speed grade of a connected Crono devic...
Definition: CRONO_SDK.h:150